var miniTab;
layui.use(['form','miniTab'], function () {
    var form = layui.form,
        miniTab = layui.miniTab;

    //监听提交
    form.on('submit(saveBtn)', function (data) {
        data = data.field;
        if (data.new_password !== data.again_password) {
            layer.msg("新密码--两次输入不一致");
            $('#new_password').val('');
            $('#again_password').val('');
        }
        globalObj.modifyPwd(data);
        miniTab.deleteCurrentByIframe();
        layer.msg('修改成功');
        return false;
    });
});

var globalObj = globalObj || {};
globalObj = $.extend(globalObj, {
    modifyPwd: function (data) {
        (new globalObj.Request(globalObj.url)).setParams({
            param: {
                password: data.old_password,
                newPwd: data.new_password
            },
            serviceId: "app.sysUser.modifyPwd"
        }).do().success(function (data) {

        });
    }
});